<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-cascades"></i> 成绩汇总
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="handle-box">
        <!--                <el-select v-model="query.address" placeholder="地址" class="handle-select mr10">-->
        <!--                    <el-option key="1" label="广东省" value="广东省"></el-option>-->
        <!--                    <el-option key="2" label="湖南省" value="湖南省"></el-option>-->
        <!--                </el-select>-->
        <el-input v-model="subjectSearch" placeholder="课程名称" class="handle-input mr10"></el-input>
        <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
      </div>
      <el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header">
        <!--                <el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>-->
        <!--        <el-table-column prop="name" label="用户名"></el-table-column>-->
        <el-table-column label="课程名称">
          <template #default="scope">{{ scope.row.subjectName }}</template>
        </el-table-column>

        <el-table-column label="考试成绩">
          <template #default="scope">{{ scope.row.examGradRecord }}</template>
        </el-table-column>
        <el-table-column label="绩效/表现成绩">
          <template #default="scope">{{ scope.row.performanceGrad }}</template>
        </el-table-column>
        <el-table-column prop="address" label="总成绩">
          <template #default="scope">{{ scope.row.totleGrad }}</template>
        </el-table-column>
      </el-table>
      <!--      <div class="pagination">-->
      <!--        <el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"-->
      <!--                       :page-size="query.pageSize" :total="pageTotal"-->
      <!--                       @current-change="handlePageChange"></el-pagination>-->
      <!--      </div>-->
    </div>

    <!-- 编辑弹出框 -->
<!--    <el-dialog title="编辑" v-model="editVisible" width="30%">-->
<!--      <el-form label-width="70px">-->
<!--        <el-form-item label="用户名">-->
<!--          <el-input v-model="form.name"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="地址">-->
<!--          <el-input v-model="form.address"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <template #footer>-->
<!--                <span class="dialog-footer">-->
<!--                    <el-button @click="editVisible = false">取 消</el-button>-->
<!--                    <el-button type="primary" @click="saveEdit">确 定</el-button>-->
<!--                </span>-->
<!--      </template>-->
<!--    </el-dialog>-->
  </div>
</template>

<script>
import {selectMyExamGrad} from "../api/index"
export default {
  name: "GradTable",
  data() {
    return {
      subjectSearch: '',
      tableData: [
        {
          subjectName: '',
          examGradRecord: '',
          performanceGrad: '',
          totleGrad: '',
        }
      ]
    }
  },
  methods:{
    handleSearch(){
      selectMyExamGrad({subjectId:this.subjectSearch}).then(res => {
        if(res.code === '200'){
          this.tableData = res.data;
          this.$message.success("查询成功");
        }else{
          this.$message.error(res.message);
        }
      })
    },
    saveEdit(){

    },
    queryMyExamGrad(){
      selectMyExamGrad().then(res => {
        if(res.code === '200'){
          this.tableData = res.data;
          this.$message.success("查询成功");
        }else{
          this.$message.error(res.message);
        }
      })
    }
  },
  mounted() {
    this.queryMyExamGrad();
  }
}
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}

.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
  display: inline-block;
}

.table {
  width: 100%;
  font-size: 14px;
}

.red {
  color: #ff0000;
}

.mr10 {
  margin-right: 10px;
}

.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
